<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title>旅游智能管控后台管理</title>
</head>

<body>
</body>
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/config.js"></script>
<script>
  $(function () {
    var accessToken = window.localStorage.getItem("backstage-access-token");
    if (window.localStorage.getItem("backstage-access-permissionList")) {
      //var accessToken = window.localStorage.getItem("backstage-access-token");
      var error = function (data) {
        window.location.href = site.interUrl + "login.html";
      };
      var ss_menus = JSON.parse(window.localStorage.getItem("backstage-access-permissionList"));
      var groups = $.grep(ss_menus, function (c) {
        return c.level == 1;
      });
      var gid = groups[0].id;
      var url = groups[0].url;
      var subid = '';
      var menuid = '';
      var subs = $.grep(ss_menus, function (c) {
        return c.parentId == gid;
      });
      if (subs.length > 0) {
        subid = subs[0].id;
        var menu = $.grep(subs, function (c) {
          return c.parentId == subid;
        });
        if (menu.length > 0) {
          url = menu[0].url;
          menuid = menu[0].id;
        }
      }
      var u = url.match(/\{\{(.+?)\}\}/g);
      if (u != "" && u != undefined) {
        var um = u.toString();
        var up = um.substring(2, um.length - 2);
        var uu = site[up];
        url = url.replace(um, uu);
      }
      /*$.ajax({
        'headers': {
          'access-token': accessToken,
        },
        'url': site.interUrl + "/sUsers/tokenValidate",
        'type':'post',
        'error': error,
        /*'success': success
      });*/
      if (subid) {
        window.location.href = url + "?groupid=" + gid + "&subid=" + subid + "&menuid=" + menuid;
        // http://192.168.1.47:5000/message/scenic/scenic-list.html?groupid=jqgl030&subid=jqgl030001&menuid=
        return false
      } else {
        window.location.href = url + "?groupid=" + gid;
      }
    } else {
      window.location.href = site.interUrl + "login.html";
    }
  });
</script>